package pe.gob.mimp.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import pe.gob.mimp.dao.PersonaDao;
import pe.gob.mimp.model.Persona;
import pe.gob.mimp.service.PersonaService;

@Service("personaService")
@Transactional(readOnly = true)
public class PersonaServiceImpl implements PersonaService {
	@Autowired
	private PersonaDao personaDao;

	public Persona getPersonaPorId(Long idPersona) {
		return personaDao.getPersonaPorId(idPersona);
	}

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
	public void savePersona(Persona persona) {
		personaDao.savePersona(persona);
	}

	public Persona getPersonaPorTipoDocumento(Long idTipoDocumento,
			String nroDocumento) {
		return personaDao.getPersonaPorTipoDocumento(idTipoDocumento,
				nroDocumento);
	}

}
